|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
J2eeInterfaceWriter.java | 75% | 100% | 100% | 96% |
|
1 |
/*
|
|
2 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
package org.apache.geronimo.ews.jaxrpcmapping;
|
|
17 |
|
|
18 |
import org.apache.axis.wsdl.symbolTable.BindingEntry;
|
|
19 |
import org.apache.axis.wsdl.symbolTable.Parameters;
|
|
20 |
import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
|
|
21 |
import org.apache.axis.wsdl.symbolTable.SymbolTable;
|
|
22 |
import org.apache.axis.wsdl.toJava.JavaBindingWriter;
|
|
23 |
|
|
24 |
import javax.wsdl.Operation;
|
|
25 |
import javax.wsdl.PortType;
|
|
26 |
import java.io.IOException;
|
|
27 |
import java.io.PrintWriter;
|
|
28 |
import java.util.Iterator;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* This is Wsdl2java's PortType Writer. It writes the <portTypeName>.java file
|
|
32 |
* which contains the <portTypeName> interface.
|
|
33 |
*
|
|
34 |
* @author Ias (iasandcb@tmax.co.kr)
|
|
35 |
*/
|
|
36 |
public class J2eeInterfaceWriter extends J2eeClassWriter { |
|
37 |
protected PortType portType;
|
|
38 |
protected BindingEntry bEntry;
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Constructor.
|
|
42 |
*/
|
|
43 | 3 |
protected J2eeInterfaceWriter(J2eeEmitter emitter,
|
44 |
PortTypeEntry ptEntry, BindingEntry bEntry, SymbolTable symbolTable) { |
|
45 | 3 |
super(emitter,
|
46 |
(String) bEntry.getDynamicVar(JavaBindingWriter.INTERFACE_NAME), "interface");
|
|
47 | 3 |
this.portType = ptEntry.getPortType();
|
48 | 3 |
this.bEntry = bEntry;
|
49 |
} // ctor
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Override generate method to prevent duplicate interfaces because
|
|
53 |
* of two bindings referencing the same portType
|
|
54 |
*/
|
|
55 | 3 |
public void generate() throws IOException { |
56 | 3 |
String fqClass = getPackage() + "." + getClassName();
|
57 |
|
|
58 |
// Do not emit the same portType/interface twice
|
|
59 | 3 |
if (!emitter.getGeneratedFileInfo().getClassNames().contains(fqClass)) {
|
60 | 3 |
super.generate();
|
61 |
} |
|
62 |
} // generate
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Returns "interface ".
|
|
66 |
*/
|
|
67 | 3 |
protected String getClassText() {
|
68 | 3 |
return "interface "; |
69 |
} // getClassString
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Returns "extends java.rmi.Remote ".
|
|
73 |
*/
|
|
74 | 3 |
protected String getExtendsText() {
|
75 | 3 |
return "extends java.rmi.Remote "; |
76 |
} // getExtendsText
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Write the body of the portType interface file.
|
|
80 |
*/
|
|
81 | 3 |
protected void writeFileBody(PrintWriter pw) throws IOException { |
82 | 3 |
Iterator operations = portType.getOperations().iterator(); |
83 | 3 |
while (operations.hasNext()) {
|
84 | 7 |
Operation operation = (Operation) operations.next(); |
85 | 7 |
writeOperation(pw, operation); |
86 |
} |
|
87 |
} // writeFileBody
|
|
88 |
|
|
89 |
/**
|
|
90 |
* This method generates the interface signatures for the given operation.
|
|
91 |
*/
|
|
92 | 7 |
protected void writeOperation(PrintWriter pw, Operation operation) throws IOException { |
93 | 7 |
writeComment(pw, operation.getDocumentationElement(), true);
|
94 | 7 |
Parameters parms = bEntry.getParameters(operation); |
95 | 7 |
pw.println(parms.signature + ";");
|
96 |
} // writeOperation
|
|
97 |
|
|
98 |
} |
|
99 |
|
|